//
//  MainViewController.swift
//  AAWeibo
//
//  Created by 上官风雨 on 15/11/11.
//  Copyright © 2015年 上官风雨. All rights reserved.
//

import UIKit

class MainViewController: UITabBarController {

    override func viewDidLoad() {
        super.viewDidLoad()

        let mainTabbar = MainTabBar()
        
        setValue(mainTabbar, forKey: "tabBar")
       
        addchildViewControllers()
        
    }
    
    func addchildViewControllers (){
        
        addview(HomeViewController(), title: "首页", imageName: "tabbar_home")
        addview(MessageViewController(), title: "消息", imageName: "tabbar_message_center")
        addview(DiscoverViewController(), title: "发现", imageName: "tabbar_discover")
        addview(ProfileViewController(), title: "我", imageName: "tabbar_profile")
        
    }
    
    func addview(vc :UIViewController ,title :String,imageName:String){
        
        vc.title = title
        vc.tabBarItem.image = UIImage(named: imageName)
        
        addChildViewController(UINavigationController(rootViewController: vc))
        
    }
  
}
